<extend file='resource/view/master'/>
<block name="content">
    <ul class="nav nav-tabs" role="tablist">
        <li class="active"><a href="#tab1">商品货品</a></li>
    </ul>
    <form action="" method="post">
        <input type="hidden" name="sid" value="{{q('get.sid',0,'intval')}}">
        <div class="panel panel-default">
            <div class="panel-body">
                <table class="table table-hover">
                    <thead>
                    <tr style="text-align: center">
                        <th width="80">货品ID</th>
                        <foreach from="$data" key="$k" value="$v">
                            <th>{{$v['taname']}}</th>
                        </foreach>
                        <th>库存</th>
                        <th>货号</th>
                        <th width="200">操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    <foreach from="$itemlistData" key="$k" value="$v">
                        <tr>
                            <td>{{$v['ilid']}}</td>
                            <foreach from="$v['combine']" key="$kk" value="$vv">
                                <td>{{$vv}}</td>
                            </foreach>
                            <td>{{$v['kucun']}}</td>
                            <td>{{$v['no']}}</td>
                            <td>
                                <div class="btn-group">
                                    <button data-toggle="dropdown" class="btn btn-primary btn-xs dropdown-toggle" onclick="del({{$v['ilid']}},{{q('get.sid',0,'intval')}})">删除</button>
                                </div>
                            </td>
                        </tr>
                    </foreach>

                    </tbody>

                </table>
                <table class="table table-hover">
                    <td style="width:50px;">添加货品</td>
                    <foreach from="$data" key="$k" value="$v">
                        <td>
                            <select name="combine[{{$k}}]" id="" class="js-example-basic-single form-control">
                                <option value="0">请选择</option>
                                <foreach from="$v['select']" key="$kk" value="$vv">
                                    <option value="{{$vv['said']}}">{{$vv['stvalue']}}</option>
                                </foreach>
                            </select>
                        </td>
                    </foreach>

                    <td>
                        <input type="text" name="no"  class="form-control" placeholder="请输入货号" style="width:180px;">
                    </td>
                    <td>
                        <input type="text" name="kucun"  class="form-control" placeholder="请输入库存" style="width:180px;">
                    </td>
                    <td style="width:150px;"></td>
                </table>
                <button class="btn btn-primary" type="submit">确定<tton>
            </div>
        </div>
        </div>
    </form>
    <div class="pagination pagination-sm pull-right">
    </div>
</block>
<script>
    function del(ilid,sid)
    {
        var obj = util.modal({
            title:'确认删除？',//标题
            content:'',//内容
            footer:'<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button><button type="button" class="btn btn-danger confirm" data-dismiss="modal">确定</button>',//底部
            width:500,//宽度
            events:{
                confirm:function(){
                    //哪个元素上有.confirm类，被点击就执行这个回调
                    location.href="{{u('del')}}" + '&ilid=' + ilid+'&sid='+sid;
                }
            }
        });
        //显示模态框
        obj.modal('show');
    }
</script>
